package com.neu.wms.service.impl;

import com.neu.wms.dto.AreaDto;
import com.neu.wms.entity.WmsArea;
import com.neu.wms.mapper.WmsAreaMapper;
import com.neu.wms.service.AreaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AreaServiceImpl implements AreaService {

    @Autowired
    private WmsAreaMapper wmsAreaMapper;

    @Override
    public List<WmsArea> selectAll(AreaDto areaDto) {
        return wmsAreaMapper.selectAll(areaDto);
    }

    @Override
    public int insert(WmsArea area) {
        area.setDelFlag(0);
        return wmsAreaMapper.insertSelective(area);
    }

    @Override
    public int update(WmsArea wmsArea) {
        return wmsAreaMapper.updateByPrimaryKeySelective(wmsArea);
    }

    @Override
    public int delete(Long id) {
        return wmsAreaMapper.deleteByPrimaryKey(id);
    }

    @Override
    public WmsArea selectByPrimaryKey(Long id) {
        return wmsAreaMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateDelFlag(AreaDto areaDto) {
        return wmsAreaMapper.updateDelFlag(areaDto);
    }
}
